﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace assingment1_rowan_Hall
{
    public partial class floor : Form
    {
        PersonClass person = new PersonClass(0,0);
        Elevator ele1 = new Elevator(1, 10, 0, 1);
      
        public floor()
        {
            
           
            InitializeComponent();

            
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            System.Drawing.Pen newPen = new System.Drawing.Pen(System.Drawing.Color.Black);
            System.Drawing.Graphics formGraphics;
            formGraphics = CreateGraphics();

            int ylocation = (550 - (50 * ele1.GetFloor()));
            int xlocation = 50;
            formGraphics.DrawRectangle(newPen, xlocation, ylocation, 50, 50);
            newPen.Dispose();
            formGraphics.Dispose();
        }
        private void floor_Load(object sender, EventArgs e)
        {
            this.Size = new System.Drawing.Size(820,630);

            var a = ele1.GetFloor();
            textFloorNumb.Text = ""+ a +"" ;
            
            
        }

        public void setXAndY()
        {
 
        }


        


        private void upBtn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(10);
            Invalidate();
            
        }

        private void DownBtn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(10);
            Invalidate();
        }

        

        private void Up2Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(9);
            Invalidate();
        }

        private void Down2Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(9);
            Invalidate();
        }

        private void Up3Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(8);
            Invalidate();
        }

        private void Down3Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(8);
            Invalidate();
        }

        private void Up4Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(7);
            Invalidate();
        }

        private void Down4Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(7);
            Invalidate();
        }

        private void Up5Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(6);
            Invalidate();
        }

        private void Down5Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(6);
            Invalidate();
        }

        private void Up6Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(5);
            Invalidate();
        }

        private void Down6Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(5);
            Invalidate();
        }

        private void Up7Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(4);
            Invalidate();
        }

        private void Down7Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(4);
            Invalidate();
        }

        private void Up8Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(3);
            Invalidate();
        }

        private void Down8Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(3);
            Invalidate();
        }

        private void Up9Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(2);
            Invalidate();
        }

        private void Down9Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(2);
            Invalidate();
        }

        private void Up10Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(1);
            Invalidate();
        }

        private void Down10Btn_Click(object sender, EventArgs e)
        {
            ele1.goToFloor(1);
            Invalidate();
        }

        private void GoToFloorBtn_Click(object sender, EventArgs e)
        {

            int tempX = Int32.Parse(FloorDestinationText.Text);
            ele1.goToFloor(tempX);
            var a = ele1.GetFloor();
            textFloorNumb.Text = "" + a + "";
            Invalidate();
        }
    }
}
